#import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h"
#import "MyReader.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  // Override point for customization after application launch.
    [self flutterMsgMethod];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (void)flutterMsgMethod {
    NSObject<FlutterBinaryMessenger> *vc = (NSObject<FlutterBinaryMessenger> *)self.window.rootViewController;
    FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"methodChannel" binaryMessenger:vc];
    [channel setMethodCallHandler:^(FlutterMethodCall * call, FlutterResult result) {
        if ([call.method isEqualToString:@"startRead"]) {
            NSString *tex = call.arguments;
            [MyReader startRead:tex];
        }
        if ([call.method isEqualToString:@"stopRead"]) {
            [MyReader stopRead];
        }
    }];
}

@end
